package com.kla.power.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.kla.power.entity.InverterAcAmountEntity;
import com.kla.power.mapper.InverterAcAmountMapper;
import com.kla.power.service.IInverterAcAmountService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 交流电 服务实现类
 * </p>
 *
 * @author WuZH
 * @since 2024-06-10
 */
@Service
public class InverterAcAmountServiceImpl extends ServiceImpl<InverterAcAmountMapper, InverterAcAmountEntity> implements IInverterAcAmountService {

    @Resource
    private InverterAcAmountMapper inverterAcAmountMapper;

    @Override
    public List<InverterAcAmountEntity> queryList ( InverterAcAmountEntity acAmountEntity ) {
        LambdaQueryWrapper<InverterAcAmountEntity> lambdaQueryWrapper = new LambdaQueryWrapper ();
        if ( StringUtils.isNotBlank ( acAmountEntity.getInverterSystemId () ) ) {
            lambdaQueryWrapper.eq ( InverterAcAmountEntity :: getInverterSystemId, acAmountEntity.getInverterSystemId () );
        }
        if ( StringUtils.isNotBlank ( acAmountEntity.getInverterSn () ) ) {
            lambdaQueryWrapper.eq ( InverterAcAmountEntity :: getInverterSn, acAmountEntity.getInverterSn () );
        }
        List<InverterAcAmountEntity> list = this.list ( lambdaQueryWrapper );
        return list;
    }

    @Override
    public List<InverterAcAmountEntity> queryHistoryData (InverterAcAmountEntity inverterAcAmountEntity) {
        List<InverterAcAmountEntity> inverterAcAmountEntities = inverterAcAmountMapper.queryHistoryData ( inverterAcAmountEntity );
        return inverterAcAmountEntities;
    }
}
